package com.stargazer.ming.ui;

import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.Window;

import com.stargazer.ming.R;

public class EditMingPostUI extends MingActivity {
	final String mimeType = "text/html";
	final String encoding = "utf-8";
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
    }
	
	@Override
	protected void initView() {
		setMingTitle(R.string.common_edit);
		// title button
		setPrevBtn(getString(R.string.back), new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
		setNextBtn(getString(R.string.preview), new View.OnClickListener() {

			@Override
			public void onClick(View v) {

			}
		});
		WebView wv = (WebView) findViewById(R.id.wv_editpost);
		wv.getSettings().setJavaScriptEnabled(true);
		wv.setWebChromeClient(new WebChromeClient());
		DisplayMetrics dm = new DisplayMetrics();  
		getWindowManager().getDefaultDisplay().getMetrics(dm);  
		String url= "file:///android_asset/mingEdit.html?height="+dm.heightPixels/dm.density+"&width="+dm.widthPixels/dm.density;
        wv.loadUrl(url);
	}

	@Override
	protected int getBodyId() {
		return R.layout.activity_edit_ming_post;
	}

}
